﻿#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Tab & j::
if GetKeyState("Alt","P")
{
    Send,+{Left}
    return
}
else
{
Send,{Left}
return
}

Tab & k::
if GetKeyState("Alt","P")
{
Send, +{Down}
return
}
else
{
Send,{Down}
return
}

Tab & l::
if GetKeyState("Alt","P")
{
  Send,+{Right}
  return
}
else
{
  Send,{Right}
  return
}

Tab & i::
if GetKeyState("Alt","P")
{
Send,+{Up}
return
}
else
{
Send,{UP}
return
}

Tab & u::
if GetKeyState("Alt","P")
{
Send, +{Home}
}
else{
Send, {Home}
}
return
Tab & o::
if GetKeyState("Alt","P")
{
Send, +{End}
}
else
{
Send, {End}
}
return

Tab & y::
if GetKeyState("Alt","P")
{
Send,+{PgUp}
return
}
else
{
Send,{PgUp}
return
}

Tab & h::
if GetKeyState("Alt","P")
{
Send,+{PgDn}
return
}
else
{
Send,{PgDn}
return
}

;原本的快捷键如果不重新定义下，会没有反应 所以这里不是无用的
Tab::
Send, {Tab}
return

Alt & Tab::
Send, !{Tab}
return


+Tab::
Send, +{Tab}
return


;不知道怎么样获取当前的资源管理器路径 只能勉强先这样了
Tab & f::
FileSelectFolder, Folder
Folder := RegExReplace(Folder, "\\$") 
;MsgBox, %A_WorkingDir%
SetWorkingDir %Folder%
Run C:\Program Files\Git\git-bash.exe
return

;剪切当前一行
Tab & d::
Send, {Home}{shiftdown}{end}{shiftup}
Send,^x
clipboard=%clipboard%
;MsgBox, %A_WorkingDir%
return

;获取当前鼠标位置的颜色
Tab & c::
MouseGetPos, mouseX,mouseY
PixelGetColor,color,%mouseX%,%mouseY%,RGB
StringRight,lastColor,color,6
clipboard=%lastColor%
return

;打开终端，需要鼠标放在一个文件上
Tab & T::
Send, ^c
sleep,200
SplitPath, clipboard,OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
SetWorkingDir %OutDir%
Run C:\Program Files\Git\git-bash.exe
return

